#include "command.h"
#include <iostream>

using namespace command;

void RemoteControl::setCommand(int slot, Command* on, Command* off)
{
    this->onCommands[slot] = on;
    this->offCommands[slot] = off;
}

void RemoteControl::onButtonWasPushed(int slot)
{
    this->onCommands[slot]->execute();
}

void RemoteControl::offButtonWasPushed(int slot)
{
    this->offCommands[slot]->execute();
}

void Light::on()
{
    std::cout << "light is on!" << std::endl;
}

void Light::off()
{
    std::cout << "light is off!" << std::endl;
}

void Stereo::on()
{
    std::cout << "stereo is on!" << std::endl;
}

void Stereo::off()
{
    std::cout << "stereo is off!" << std::endl;
}

void Stereo::setCd()
{
    std::cout << "stereo set cd!" << std::endl;
}

void Stereo::setDvd()
{
    std::cout << "stereo set dvd!" << std::endl;
}

void Stereo::setRadio()
{
    std::cout << "stereo set radio!" << std::endl;
}

void Stereo::setVolume()
{
    std::cout << "stereo set volume!" << std::endl;
}

void Garagedoor::up()
{
    std::cout << "garagedoor up!" << std::endl;
}

void Garagedoor::down()
{
    std::cout << "garagedoor down!" << std::endl;
}

void Garagedoor::stop()
{
    std::cout << "garagedoor stop!" << std::endl;
}

void Garagedoor::lightOn()
{
    std::cout << "garagedoor light on!" << std::endl;
}

void Garagedoor::lightOff()
{
    std::cout << "garagedoor light off!" << std::endl;
}

LightOnCommand::LightOnCommand(Light* l)
{
    this->m_light = l;
}

void LightOnCommand::execute()
{
    this->m_light->on();
}

LightOffCommand::LightOffCommand(Light* l)
{
    this->m_light = l;
}

void LightOffCommand::execute()
{
    this->m_light->off();
}

StereoOnWithCDCommand::StereoOnWithCDCommand(Stereo* s)
{
    this->m_stereo = s;
}

void StereoOnWithCDCommand::execute()
{
    this->m_stereo->on();
    this->m_stereo->setCd();
    this->m_stereo->setVolume();
}

StereoOffCommand::StereoOffCommand(Stereo* s)
{
    this->m_stereo = s;
}

void StereoOffCommand::execute()
{
    this->m_stereo->off();
}

GarageDoorDownCommand::GarageDoorDownCommand(Garagedoor* g)
{
    this->m_garage = g;
}

void GarageDoorDownCommand::execute()
{
    this->m_garage->down();
}

GarageDoorUpCommand::GarageDoorUpCommand(Garagedoor* g)
{
    this->m_garage = g;
}

void GarageDoorUpCommand::execute()
{
    this->m_garage->up();
}
